unit uConfServer;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, IniFiles;

type
  TfConfigServer = class(TForm)
    lblHostName: TLabel;
    lblPort: TLabel;
    lblDatabase: TLabel;
    lblUser: TLabel;
    lblSenha: TLabel;
    lbl37: TLabel;
    btn_Confirmar: TBitBtn;
    edtHostName: TEdit;
    edtPort: TEdit;
    edtDatabase: TEdit;
    edtUser: TEdit;
    edtPass: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure btn_ConfirmarClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fConfigServer: TfConfigServer;

implementation

{$R *.dfm}

procedure TfConfigServer.btn_ConfirmarClick(Sender: TObject);
var
  data: TInifile;
begin
  data := TIniFile.Create(ExtractFilePath(Application.ExeName) +  '\ConfigBD.ini');
  data.WriteString('DADOSBD', 'HOSTNAME', edtHostName.Text);
  data.WriteString('DADOSBD', 'PORT', edtPort.Text);
  data.WriteString('DADOSBD', 'DATABASE', edtDatabase.Text);
  data.WriteString('DADOSBD', 'USER', edtUser.Text);
  data.WriteString('DADOSBD', 'PASSWORD', edtPass.Text);
  data.Free;
end;

procedure TfConfigServer.FormCreate(Sender: TObject);
var
  data: TInifile;
begin
  data := TIniFile.Create(ExtractFilePath(Application.ExeName) +  '\ConfigBD.ini');
  edtHostName.Text := data.ReadString('DADOSBD', 'HOSTNAME', '');
  edtPort.Text := data.ReadString('DADOSBD', 'PORT', '');
  edtDatabase.Text := data.ReadString('DADOSBD', 'DATABASE', '');
  edtUser.Text := data.ReadString('DADOSBD', 'USER', '');
  edtPass.Text := data.ReadString('DADOSBD', 'PASSWORD', '');
  data.Free;
end;

end.

